#  Copyright (c) 1998-2008 World Wide Web Consortium
#  (Massachusetts Institute of Technology, European Research 
#  Consortium for Informatics and Mathematics, Keio University).
#  All Rights Reserved.
#
#  Contributing Author(s):
#  Dave Raggett <dsr@w3.org>
#
#  The contributing author(s) would like to thank all those who
#  helped with testing, bug fixes and suggestions for improvements. 
#  This wouldn't have been possible without your help.
#
#  COPYRIGHT NOTICE:
#                           
#  This software and documentation is provided "as is," and
#  the copyright holders and contributing author(s) make no
#  representations or warranties, express or implied, including
#  but not limited to, warranties of merchantability or fitness
#  for any particular purpose or that the use of the software or
#  documentation will not infringe any third party patents,
#  copyrights, trademarks or other rights. 
#
#  The copyright holders and contributing author(s) will not be held
#  liable for any direct, indirect, special or consequential damages
#  arising out of any use of the software or documentation, even if
#  advised of the possibility of such damage.
#
#  Permission is hereby granted to use, copy, modify, and distribute
#  this source code, or portions hereof, documentation and executables,
#  for any purpose, without fee, subject to the following restrictions:
#
#   1. The origin of this source code must not be misrepresented.
#   2. Altered versions must be plainly marked as such and must
#      not be misrepresented as being the original source.
#   3. This Copyright notice may not be removed or altered from any
#      source or altered source distribution.
#                                          
#  The copyright holders and contributing author(s) specifically
#  permit, without fee, and encourage the use of this source code
#  as a component for supporting the Hypertext Markup Language in
#  commercial products. If you use this source code in a product,
#  acknowledgment is not required but would be appreciated.

"""The Tidy wrapper.
I am the main interface to TidyLib. This package supports processing HTML with
Tidy, with all the options that the tidy command line supports.

For more information on the tidy options, see the reference. These options can
be given as keyword arguments to parse and parseString, by changing dashes (-)
to underscores(_).

For example:

>>> import tidy
>>> options = dict(output_xhtml=1, add_xml_decl=1, indent=1, tidy_mark=0)
>>> print tidy.parseString('<Html>Hello Tidy!', **options)
<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>
  <body>
    Hello Tidy!
  </body>
</html>

For options like newline and output_encoding, which must be set to one of a
fixed number of choices, you can provide either the numeric or string version
of the choice; so both tidy.parseString('<HTML>foo</html>', newline=2) and
tidy.parseString('<HTML>foo</html>', newline='CR') do the same thing.  

There are no plans to support other features of TidyLib, such as document-tree
traversal, since Python has several quality DOM implementations. (The author
uses Twisted's implementation, twisted.web.microdom).
"""

try:
    dict(x=1)
except TypeError:
    raise ImportError("Python 2.3 or later is required to import this library.")

__all__ = ['error', 'lib']

from tidy.lib import parse, parseString
from tidy.error import *

